/**
 * Ningping Gou 
 * Date: 12-7-17
 */
package cn.gnp.framework.rop.sample;

import cn.gnp.framework.rop.RopRequest;
import cn.gnp.framework.rop.RopRequestContext;
import cn.gnp.framework.rop.event.PreDoServiceEvent;
import cn.gnp.framework.rop.event.RopEventListener;
import cn.gnp.framework.rop.marshaller.MessageMarshallerUtils;

/**
 * <pre>
 * 功能说明：
 * </pre>
 *
 * @author Ningping Gou
 * @version 1.0
 */
public class SamplePreDoServiceEventListener implements RopEventListener<PreDoServiceEvent> {

    @Override
    public void onRopEvent(PreDoServiceEvent ropEvent) {
        RopRequestContext ropRequestContext = ropEvent.getRopRequestContext();
        if(ropRequestContext != null && ropRequestContext.getRopRequest() != null){
            RopRequest ropRequest = ropRequestContext.getRopRequest();
            String message = MessageMarshallerUtils.getMessage(ropRequest, ropRequestContext.getMessageFormat());
            System.out.println("message("+ropEvent.getServiceBeginTime()+")"+message);
        }
    }

    @Override
    public int getOrder() {
        return 1;
    }
}

